<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<meta name="description" content="">
<meta name="author" content="">

<title>添加商品</title>

<!-- Bootstrap core CSS -->
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="<%=basePath%>css/designer.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
   
<script src="<%=basePath%>js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
window.name = "curWindow";

function submitForm() {
  	$("#itemForm").submit();
}
</script>
<c:if test="${not empty closeWindow }">
  <script type="text/javascript">
  	alert("添加成功");
  	window.close();
  </script>
</c:if>
</head>

<body>

  <div class="container">
    <form id="itemForm" action="/designer/saveItem" method="post" target="curWindow">
      <input type="hidden" name="pid" value="${product.p_id }">
      <input type="hidden" name="cid" value="${product.c_id }">
    <table class="modelTable">
      <tr>
        <td width="80px;">类别</td>
        <td>${catalogName }</td>
      </tr>
      <tr>
        <td>品牌</td>
        <td>${product.brand }</td>
      </tr>
      <tr>
        <td>型号</td>
        <td>${product.type }</td>
      </tr>
      <tr>
        <td>规格</td>
        <td>${product.spec }</td>
      </tr>
      <tr>
        <td>单位</td>
        <td>${product.unit }</td>
      </tr>
      <tr>
        <td colspan="2"><hr></td>
      </tr>
      <c:if test="${product.c_id == 3}">
        <tr>
          <td>上柜数量&nbsp;<font color="red">*</font></td>
          <td><input type="text" name="topCount" size="10" ></td>
        </tr>
        <tr>
          <td>下柜数量&nbsp;<font color="red">*</font></td>
          <td><input type="text" name="bottomCount" size="10" ></td>
        </tr>
      </c:if>
      <c:if test="${product.c_id != 3 }">
        <tr>
          <td>购买数量&nbsp;<font color="red">*</font></td>
          <td><input type="text" name="count" size="10" ></td>
        </tr>
      </c:if>
      <tr>
        <td>安装位置&nbsp;<font color="red">*</font></td>
        <td><input type="text" name="location" size="60"></td>
      </tr>
      <tr>
        <td>备注&nbsp;<font color="red">*</font></td>
        <td>
          <textarea name="remark" rows="5" cols="60"></textarea>
        </td>
      </tr>
      <tr>
        <td colspan="2"><hr></td>
      </tr>
      <tr>
        <td></td>
        <td>
          <input type="submit" class="btn btn-primary" value="保存" onclick="submitForm();">&nbsp;
          <input type="button" class="btn" value="取消" onclick="window.close();">&nbsp;
        </td>
      </tr>
    </table>
    </form>
  </div>
</body>

</html>